/**
 * 
 */
package com.demo2do.strawberry.entity.startup.detail;

/**
 * @author lute
 */
public enum ResourceType {
	
	PICTURE("enum.resource-type.picture"),
	
	VIDEO("enum.resource-type.video");
	
	private String key;
	
	/**
	 * default constructor
	 */
	private ResourceType() {
		
	}
	
	/**
	 * 
	 * @param key
	 */
	private ResourceType(String key) {
		this.key = key;
	}
	
	/**
	 * @return the key
	 */
	public String getKey() {
		return key;
	}
	
	/**
	 * @return the alias of ResourceType
	 */
	public String getAlias() {
		return this.key.substring(key.lastIndexOf(".") + 1);
	}
	
	/**
	 * @param value
	 * @return
	 */
	public static ResourceType aliasOf(String value) {
		for(ResourceType resourceType : ResourceType.values()) {
			if(resourceType.getAlias().equalsIgnoreCase(value)) {
				return resourceType;
			}
		}
		return null;
	}

}
